home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT40.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  3.7 KB  |  110 lines

  1. /*
  2. ==============================================================================
  3.                       WordUp Graphics Toolkit Version 5.0                     
  4.                              Demonstration Program 40                         
  5.                                                                               
  6.   Shows how to use the drop down menu library.                                
  7.                                                                               
  8.   *** PROJECT ***                                                             
  9.   This program requires the WGT5_WC.LIB and WMENU_WC.LIB files to be linked.  
  10.                                                                               
  11.   *** DATA FILES ***                                                          
  12.   LITTLE.WFN must be in your executable directory.                        
  13.                                                            WATCOM C++ VERSION 
  14. ==============================================================================
  15. */
  16.  
  17. #include <dos.h>
  18. #include <conio.h>
  19. #include <stdio.h>
  20. #include <wgt5.h>
  21. #include <wgtmenu.h>
  22.  
  23. wgtfont little;
  24. color pal[256];
  25. char *menubar[10]={" QUIT  "," MENU1  "," MENU2 "," MENU3  ",NULL,NULL,NULL,NULL,NULL,NULL};
  26. short menuchoice;
  27.  
  28. short oldmode;
  29.  
  30. void main (void)
  31. {
  32.   oldmode = wgetmode ();
  33.   
  34.   printf ("WGT Example #40\n\n");
  35.   printf ("Some simple drop-down menus are created. Choose the QUIT menu to end the\n");
  36.   printf ("program.\n");
  37.   printf ("\n\nPress any key to continue.\n");
  38.   getch ();
  39.  
  40.   vga256 ();
  41.   /* change the directory if needed */
  42.   little = wloadfont ("little.wfn");
  43.  
  44.   wreadpalette (0, 255, pal);
  45.   wsetrgb (1, 63, 63, 63, pal);
  46.   wsetrgb (253, 50, 50, 50, pal);
  47.   wsetrgb (254, 40, 40, 40, pal);
  48.   wsetrgb (255, 30, 30, 30, pal);
  49.   wsetpalette (0, 255, pal);
  50.  
  51.   menubarcolor = 254;
  52.   menubartextcolor = 1;
  53.   bordercolor = 255;
  54.   highlightcolor = 144;
  55.  
  56.   menufont = little;
  57.  
  58.   strcpy (dropdown[0].choice[0], " QUIT ");
  59.  
  60.   strcpy (dropdown[1].choice[0], "This is a drop");
  61.   strcpy (dropdown[1].choice[1], "down menu. You can");
  62.   strcpy (dropdown[1].choice[2], "put any text in here");
  63.   strcpy (dropdown[1].choice[3], "and WGT Menus will");
  64.   strcpy (dropdown[1].choice[4], "handle the rest.");
  65.   strcpy (dropdown[1].choice[5], "--------------------");
  66.   strcpy (dropdown[1].choice[6], "You can have up to");
  67.   strcpy (dropdown[1].choice[7], "ten choices per menu");
  68.   strcpy (dropdown[1].choice[8], "and up to ten menus.");
  69.  
  70.   strcpy (dropdown[2].choice[0], " Choice #1 ");
  71.   strcpy (dropdown[2].choice[1], " Choice #2 ");
  72.   strcpy (dropdown[2].choice[2], " Choice #3 ");
  73.   strcpy (dropdown[2].choice[3], "You can even change");
  74.   strcpy (dropdown[2].choice[4], "the colors of each");
  75.   strcpy (dropdown[2].choice[5], "dropdown menu.");
  76.  
  77.   strcpy (dropdown[3].choice[0], "You can also use");
  78.   strcpy (dropdown[3].choice[1], "any font, as long");
  79.   strcpy (dropdown[3].choice[2], "as all the menus");
  80.   strcpy (dropdown[3].choice[3], "fit on the screen.");
  81.   strcpy (dropdown[3].choice[4], "******************");
  82.   strcpy (dropdown[3].choice[5], "Try changing");
  83.   strcpy (dropdown[3].choice[6], "menufont to NULL");
  84.   strcpy (dropdown[3].choice[7], "and the default");
  85.   strcpy (dropdown[3].choice[8], "font will be used.");
  86.   strcpy (dropdown[3].choice[9], "******************");
  87.  
  88.   initdropdowns ();
  89.  
  90.   dropdown[2].color = 12;
  91.   dropdown[2].bordercolor = 14;
  92.   dropdown[2].textcolor = 1;
  93.  
  94.   showmenubar ();
  95.  
  96.   mon ();
  97.  
  98.   do { 
  99.     menuchoice = checkmenu ();
  100.   } while (menuchoice != 0);
  101.  
  102.   removemenubar ();
  103.   wfreefont (little);
  104.   mdeinit ();
  105.   wsetmode (oldmode);
  106.   while (kbhit ()) getch ();
  107. }
  108.  
  109.  
  110.